import { MenuItem } from "@/components/common/globalSider/types"
import { FormatMessageProps } from "@/locales"

export const getItem = (
	label: React.ReactNode,
	key: React.Key,
	icon?: React.ReactNode,
	children?: MenuItem[],
	type?: "group"
): MenuItem => {
	return {
		key,
		icon,
		children,
		label,
		type
	} as MenuItem
}

/**
 * Maps the business model number to its corresponding content to render.
 *
 * @param model - The business model number.
 * @param f - The format message function.
 * @returns The string based on the business model number.
 */
export const mappingBusinessModel = (model: number, f: FormatMessageProps) => {
	let contentToRender
	switch (model) {
		case 0:
			contentToRender = f({ id: "label.business_model_both" })
			break
		case 1:
			contentToRender = f({ id: "label.business_model_cash" })
			break
		case 2:
			contentToRender = f({ id: "label.business_model_credit" })
			break
		default:
			contentToRender = "-"
	}
	return contentToRender
}
